﻿{template "content","header"}

{template "content","header_nav_back_ref"}

<!-- main -->
<div class="h_48"></div>
<main class="main">
<script type="text/javascript" src="{JS_PATH2}TouchSlide.js"></script>
<script type="text/javascript">
$(function() {
	TouchSlide({
		slideCell: "#slideBox",
		titCell: ".hd ul",
		mainCell: ".bd ul",
		effect: "leftLoop",
		autoPage: true,
		autoPlay: true
	});
});
</script>
<section id="slideBox" class="slideBox">
	<div class="bd">
		<ul>
{loop $arr_pic $r}
			<li><a href="javascript:void(0);"><img src="{$r[url]}"></a></li>
{/loop}
		</ul>
	</div>
	<div class="hd">
		<ul></ul>
	</div>
</section>

<div class="border11"></div>
<div class="bookShare clearfix">
	<div class="bookSharecon fl">{$title}<span><i></i>{$price_jifen}</span></div>
	<div class="bookShareicon fr icon_share"><i></i>分享</div>
</div>
<div class="h_10"></div>
<div class="articleDetail bgwhite">
	<div class="articleDetailtitle">商品详情</div>
	<div class="border11"></div>
</div>
<div class="articleDetailcon">{$content}</div>
<div class="h_70"></div>

{php $userid= param::get_cookie('_userid');}
{if !$userid}
<div class="btn_dui"><a class="js_duihuan" href="{MEMBER_PATH}&forward={php echo urlencode($url)}">立即兑换</a></div>
{else}
<?php
$db_member = pc_base::load_model('member_model');
$info = $db_member->get_one(array('userid' => $userid));
?>
{if $info[exp]<200}
<div class="btn_dui"><a href="javascript:alert_msg('个人等级需要达到 2 级才能兑换');" class="js_duihuan">立即兑换</a></div>
{else}
<div class="btn_dui"><a href="javascript:void(0);" class="js_duihuan" data-reveal-id="myModal1" data-animation="fade">立即兑换</a></div>
<script type="text/javascript" src="{JS_PATH2}jquery.reveal.js"></script>
<div class="reveal-modal middle" id="myModal1">
	<h1>收货信息</h1>
	<form action="" class="getmessage" method="post" id="myform">
		<input type="hidden" name="catid" value="{$catid}">
		<input type="hidden" name="id" value="{$id}">
		<label><span>收货人</span><input type="text" name="realname" placeholder="请填写收货人" value="<?=$info['realname'] ?: ''?>"></label>
		<label><span>联系电话</span><input type="text" name="mobile" placeholder="请填写联系电话" value="<?=$info['mobile'] ?: ''?>"></label>
		<label>
			<span>省市</span>
			<select name="city">
				<option value="">---</option>
{php $city_arr = getcache(1, 'linkage')}
{loop $city_arr[data] $city_one}
{if $city_one[parentid]==0}
				<option value="{$city_one[linkageid]}">{$city_one[name]}</option>
{/if}
{/loop}
			</select>
			<i></i>
		</label>
		<label><span>详细地址</span><input type="text" name="address" placeholder="请填写联系地址"></label>
		<div class="getbtn_submit">
			<a class="close-reveal-modal fl">取 消</a>
			<a class="btn_submit js_submit fr">确 定</a>
		</div>        
	</form>
</div>
<script type="text/javascript">
$(function() {
	$('.js_submit').click(function() {
		var _url = '{APP_PATH}index.php?m=api&c=mall&a=buy';
		var _data = $('#myform').serializeArray();
		for (var i in _data) {
			if (!_data[i].value) {
				alert_msg('信息填写不完整');
				console.log(_data[i]);
				return false;
			}
		}
		$.ajax({
			type: 'post',
			url: '/index.php?m=api&c=mall&a=buy',
			data: _data,
			dataType: 'json',
			success: function(res) {
				console.info(res);
				if (res.status == 100) {
					//success
					alert_msg(res.desc);
					$('.close-reveal-modal').trigger('click');
				} else {
					alert_msg(res.desc);
				}
			}
		});
	});
});
</script>
{/if}
{/if}
</main>
<!-- / main -->

{template "content","share"}

{template "content","footer"}